package com.hrhx.duhongming.web.vis;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import com.github.duhongming.vis.ItemsDataSet;
import com.hrhx.duhongming.utils.JsonUtil;

@Controller
@RequestMapping(value="/vis")
public class VisTimelineController {
	@Autowired
	private JsonUtil jsonUtil;
	@RequestMapping(value="timeline")
	public String visDemo(ModelMap modelMap){
		List<ItemsDataSet> dataSetList = new ArrayList<ItemsDataSet>();
		ItemsDataSet dataSet = new ItemsDataSet("1", "<span style=\"color:#97B0F8;\">(item 1)</span>", "2017-09-16", null);
		dataSetList.add(dataSet);
		dataSet = new ItemsDataSet("2", "item 2", "2017-09-14", null);
		dataSetList.add(dataSet);
		dataSet = new ItemsDataSet("3", "item 3", "2017-09-18", null);
		dataSetList.add(dataSet);
		dataSet = new ItemsDataSet("4", "item 4", "2017-09-16", "2017-09-19");
		dataSetList.add(dataSet);
		
		modelMap.put("dataSetList", jsonUtil.toStrings(dataSetList));
		return "/vis/timeline";
		
	}
}
